# 步骤1: 创建目录结构
name=mypackage
mkdir -p $name/debian 
mkdir -p $name/usr/bin
 
# 步骤2: 创建控制脚本
cat << EOF > $name/debian/control
Package: $name
Version: 1.0-1
Section: utils
Priority: optional
Architecture: all
Depends:
Maintainer: Your Name <your.email@example.com>
Description: This is an example APT package.
EOF
 
# 步骤3: 创建安装脚本
cat << 'EOF' > $name/debian/rules
#!/usr/bin/make -f
 
export DH_VERBOSE=1
 
%:
    dh $@
 
override_dh_install:
    mkdir -p debian/mypackage/usr/bin
    cp myscript debian/mypackage/usr/bin
EOF
 
chmod +x mypackage/debian/rules
 
# 步骤4: 构建包
cd mypackage
debuild -us -uc
 
# 结果将在父目录的子目录中，例如：../mypackage_1.0-1_all.deb